#makefile

OPENCVFLAGS := `pkg-config --cflags opencv`
OPENCVLIBS := `pkg-config --libs opencv`
CC := g++ -Wall

headers = OpenCVFacialDetectorBase.h BaseData.h GetFace.h

base = OpenCVFacialDetectorBase.o
objects_ =	GetFace.o
objects_all = $(base) $(objects_)

PLUGINS_DIR = plugins
shared_all = $(PLUGINS_DIR)/GenderPlugin.so $(PLUGINS_DIR)/FaceSaverPlugin.so

exes = GetFace

all:$(exes) $(shared_all)

GetFace: $(base) $(objects_)
	$(CC)  $^ -o $@ $(OPENCVLIBS) -ldl -rdynamic

$(objects_all): %.o: %.cpp $(headers)
	$(CC)  $(OPENCVFLAGS) -g -c $< -o $@

$(shared_all): %.so: %.cpp $(headers)
	$(CC)  $(OPENCVFLAGS) -fPIC -shared -g -o $@ $< #no '-c'

clean:
	rm -fv $(objects_all) $(shared_all)	$(exes)
